#ifndef _IO_H_
#define _IO_H_

#include "stm32f10x.h"

#define USART_PRINT_NUM                             1
#define SPI_SD_TF_CARD_NUM                          1

#if( USART_PRINT_NUM == 1 )
    #define USART_PRINT 							USART1
    #define USART_PRINT_IRQ							USART1_IRQn
    #define USART_PRINT_CLK							RCC_APB2Periph_USART1
    #define USART_PRINT_TX_CLK						RCC_APB2Periph_GPIOA
    #define USART_PRINT_TX_PORT						GPIOA
    #define USART_PRINT_TX_PIN						GPIO_Pin_9
    #define USART_PRINT_RX_CLK 						RCC_APB2Periph_GPIOA
    #define USART_PRINT_RX_PORT						GPIOA
    #define USART_PRINT_RX_PIN						GPIO_Pin_10
    #define USART_IRQ_HANDLE                        USART1_IRQHandler
#elif( USART_PRINT_NUM == 5 )
    #define USART_PRINT 							UART5
    #define USART_PRINT_IRQ							UART5_IRQn
    #define USART_PRINT_CLK							RCC_APB1Periph_UART5
    #define USART_PRINT_TX_CLK						RCC_APB2Periph_GPIOC
    #define USART_PRINT_TX_PORT						GPIOC
    #define USART_PRINT_TX_PIN						GPIO_Pin_12
    #define USART_PRINT_RX_CLK 						RCC_APB2Periph_GPIOD
    #define USART_PRINT_RX_PORT						GPIOD
    #define USART_PRINT_RX_PIN						GPIO_Pin_2
#endif

#if ( SPI_SD_TF_CARD_NUM == 1 )
    #define SD_SPI                           		SPI1
    #define SD_SPI_CLK                       		RCC_APB2Periph_SPI1
    #define SD_SPI_SCK_PIN                   		GPIO_Pin_5               
    #define SD_SPI_SCK_GPIO_PORT             		GPIOA                    
    #define SD_SPI_SCK_GPIO_CLK              		RCC_APB2Periph_GPIOA
    #define SD_SPI_MISO_PIN                  		GPIO_Pin_6                
    #define SD_SPI_MISO_GPIO_PORT            		GPIOA                  
    #define SD_SPI_MISO_GPIO_CLK             		RCC_APB2Periph_GPIOA
    #define SD_SPI_MOSI_PIN                  		GPIO_Pin_7               
    #define SD_SPI_MOSI_GPIO_PORT            		GPIOA                   
    #define SD_SPI_MOSI_GPIO_CLK             		RCC_APB2Periph_GPIOA
    #define SD_CS_PIN                        		GPIO_Pin_4              
    #define SD_CS_GPIO_PORT                  		GPIOA                    
    #define SD_CS_GPIO_CLK                   		RCC_APB2Periph_GPIOA
#endif

#endif
